package com.example.icongyou.api;


import com.example.icongyou.bean.TeacherCourse;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * 对应后端 TeacherCourseController 的 RESTful API 接口定义
 * 基础路径: /api/teacher_courses
 */
public interface TeacherCourseApi {

    // POST /api/teacher_courses/{teacherId}/courses/{courseId} - 创建关联
    // 成功返回 TeacherCourse 对象，失败返回 String 错误信息 (409/400)
    @POST("api/teacher_courses/{teacherId}/courses/{courseId}")
    Call<TeacherCourse> createAssociation(
            @Path("teacherId") String teacherId,
            @Path("courseId") String courseId
    );
    // 注意：这里的 Call<TeacherCourse> 映射后端成功时的 201 CREATED。

    // DELETE /api/teacher_courses/{teacherId}/courses/{courseId} - 解除关联
    @DELETE("api/teacher_courses/{teacherId}/courses/{courseId}")
    Call<Void> deleteAssociation(
            @Path("teacherId") String teacherId,
            @Path("courseId") String courseId
    ); // 后端返回 204 No Content，使用 Call<Void>

    // GET /api/teacher_courses/teacher/{teacherId} - 查询某个教师关联的所有课程记录
    @GET("api/teacher_courses/teacher/{teacherId}")
    Call<List<TeacherCourse>> getCoursesByTeacher(@Path("teacherId") String teacherId);

    // GET /api/teacher_courses/course/{courseId} - 查询某个课程关联的所有教师记录
    @GET("api/teacher_courses/course/{courseId}")
    Call<List<TeacherCourse>> getTeachersByCourse(@Path("courseId") String courseId);
}